<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="app" uri="/WEB-INF/tld/app.tld" %>
<%@ taglib prefix="ct" uri="/WEB-INF/tld/commonTag.tld" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> 
<%@ include file="/WEB-INF/jsp/common/common_header.jsp" %>
<%@ include file="/WEB-INF/jsp/common/common.jsp" %>


<script language="javascript">
    

	function funcDetail(cardComCd ,expectTransDate) {
		width = 960;
		height = 800;
		var user_id = $("#user_id").val();
	    x = (screen.width) ? (screen.width-width)/2 : 0;
	    y = (screen.height) ? (screen.height-height)/2 : 0;
	    var popUrl = 'popCardBillSeperateDetailInfo.do?expectTransDate='+expectTransDate+'&cardComCd='+cardComCd+'&user_id='+user_id;
	    var win =window.open(popUrl,'popCardBillSeperateDetailInfo', 'left=' + x + ',top=' + y + ',width=' + width + ',height=' + height + ',scrollbars=yes,status=no,menubar=no');
	    win.focus();
	}


	
    // 검색 버튼 클릭
    function funcSearch() {

        var searchStRegDt = document.getElementById('searchStRegDt').value.replace(/-/gi,"");
        var searchEdRegDt = document.getElementById('searchEdRegDt').value.replace(/-/gi,"");

        if(searchStRegDt > searchEdRegDt){ 
            alert("등록일의 시작일이 종료일보다 큽니다.");
            return false;
        }
        
        var fm  = document.form;
        fm.action = 'popCardBillDetailInfo.do';
        fm.submit();
    }
    
    // 엑셀다운
    function funcExcel(excelType){
        $("#excelType").val(excelType);
        document.form.action = 'findShoppingSpcExcel.omp';
        document.form.submit(); 
    }
    //////////////////////////////////
    //jQuery datepicker Form set
    ///////////////////////////////// 
    $(function() {
        $("#searchStRegDt").koreadate();
        $("#searchEdRegDt").koreadate();
    });    

        
    </script>
</head>
<body>
<div class="con_area" style="width: 980px">
<form id="form" name="form" action="" >
<input type="hidden" id="user_id" name="user_id" value="${model.user_id}"/>
<br>
<br>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
    <tr>
        <td align="left"><h2 class="tit">카드사입금내역 상세조회</h2></td>
        
    </tr>
</table>
    <div style="margin-top:7px"/>
<table cellpadding="0" cellspacing="0" border="0" class="data_table_01">
    <tr>
        <td class="data_01" style='width:140px; text-align:left;'>&nbsp;카드사입금내역 상세조회</td>
        <td class="data_02">
            <input type='text' id="searchStRegDt" name="searchStRegDt" value="${model.searchStRegDt}" title="YYYY-MM-DD" style="width: 100px;" maxlength="10" readonly/>
            ~
            <input type='text' id="searchEdRegDt" name="searchEdRegDt" value="${model.searchEdRegDt}" title="YYYY-MM-DD" style="width: 100px;" maxlength="10" readonly/>
             &nbsp;
            <input type='button' class='button_63_01' value='검색' onclick='funcSearch();'>
            <input type="button" class="button_80" value="최근 1주일" onclick="setOrderSearchDateAdminPoC('7day',form.searchStRegDt, form.searchEdRegDt);" />
            <input type="button" class="button_80" value="최근 1개월" onclick="setOrderSearchDateAdminPoC('1month',form.searchStRegDt, form.searchEdRegDt);" />
            <input type="button" class="button_80" value="최근 3개월" onclick="setOrderSearchDateAdminPoC('3month',form.searchStRegDt, form.searchEdRegDt);" />
        </td>
    </tr>  
</table>
<br><br>  
<table cellpadding="0" cellspacing="0" border="0" width="100%">
    <tr>
        <td align="left"><b>&nbsp;★  카드사입금내역 상세조회 -  가맹점명 : ${memberInfo.storeName}- ${memberInfo.comCeo }</b></td>
        
    </tr>
</table>
<br><br>
<c:set var="leftDiv" value="30px"/>
<c:set var="topDiv" value="150px"/>
<c:set var="topVaule" value="140"/>


<c:forEach begin="1" end="${billCount}" varStatus="status">
<c:set var="totalVaule" value="0"/>
<c:set var="totalExpectVaule" value="0"/>
<c:set var="expectTransDate" value=""/>

	<c:if test="${status.count%2==0 }">
		<c:set var="leftDiv" value="500px"/>
	</c:if>
	<c:if test="${status.count%2!=0 }">
		<c:set var="leftDiv" value="30px"/>
			<c:if test="${status.count>=3}">
				<c:set var="topVaule" value="${topVaule + 350}"/>
				<c:set var="topDiv" value="${topVaule}px"/>			
			</c:if>
	</c:if>
<div style="position:absolute; left:${leftDiv}; top:${topDiv}; width:450px;  height: 137px;">
        <table cellpadding="0" cellspacing="0" border="0" class="data_table_01" width="100%">
            <tr>
                <c:forEach var="vo" items="${cardBillDetailInfoList}" varStatus="voStat">
                	<c:if test="${voStat.count eq (10*status.count)}">
            	<td rowspan=13 class="data_01" style=' text-align:center;'>&nbsp;${vo.expectTransDate}</td>
            		</c:if>
            	</c:forEach>
                <td class="data_12" style=' text-align:center;'>&nbsp;카드사</td>
                <td class="data_12" style=' text-align:center;'>&nbsp;입금예정액</td>
                <td class="data_12" style=' text-align:center;'>&nbsp;실입금액</td>
            </tr>
            <c:forEach var="vo" items="${cardBillDetailInfoList}" varStatus="voStat">
            <c:if test="${voStat.count >=((10*status.count)-9) and voStat.count<=(10*status.count)}">
            <tr style='height:15px'>
                <td class="data_12" style=' text-align:center;'>&nbsp;${vo.cdNm}</td>
                <td class="data_13" style=' text-align:right; cursor:pointer;'>&nbsp;<a href="javascript:funcDetail('${vo.dtlCd}','${vo.expectTransDate}')" ><u><font color=red><fmt:formatNumber value="${vo.prodAmt}" pattern="#,###" /></font></u></a>&nbsp;&nbsp;</td>
                <td class="data_13" style=' text-align:right;'>&nbsp;<fmt:formatNumber value="${vo.expectProdAmt}" pattern="#,###" />&nbsp;&nbsp;</td>
            </tr>     
            <c:set var="totalVaule" value="${totalVaule + vo.prodAmt}"/>
            <c:set var="totalExpectVaule" value="${totalExpectVaule + vo.expectProdAmt}"/>
            <c:set var="expectTransDate" value="${vo.expectTransDate}"/>
            </c:if>
            </c:forEach>
            <tr style='height:15px'>
                <td class="data_12" style=' text-align:center;'>&nbsp;합계</td>
                <td class="data_13" style=' text-align:right; cursor:pointer;'>&nbsp;<a href="javascript:funcDetail('00','${expectTransDate}')" ><u><font color=red><fmt:formatNumber value="${totalVaule}" pattern="#,###" /></font></u></a>&nbsp;&nbsp;</td>
                <td class="data_13" style=' text-align:right;'>&nbsp;<fmt:formatNumber value="${totalExpectVaule}" pattern="#,###" />&nbsp;&nbsp;</td>
            </tr>             
                 
		</table>            
</div>
</c:forEach>
</form>
</div>
</body>

